
<script type="text/javascript" src="<?php echo $url_template?>/js/bootstrap-wysiwyg.js"></script>
<link href="<?php echo $url_template?>/css/bootstrap-wysiwyg.css" rel="stylesheet">

<h2>Modifier Page: <?php echo $page->name?></h2>
<form name="post" action="<?php echo $CFG->config['base_url']?>page/admin/page_edit" method="post" id="post" class="form-inline" enctype="multipart/form-data">

<div id="post-body" class="span8">

		<input type="text" name="name" size="30" value="<?php echo $page->name?>" id="name" autocomplete="on" placeholder="Nom de page" title="afficher dans onglet de navigateur" />
		<input type="text" name="title" size="30" value="<?php echo $page->title?>" id="title" autocomplete="on" placeholder="Saisissez le titre ici"/>
		<input type="hidden" name="id" size="30" value="<?php echo $page->id?>" id="id" />
		<input type="hidden" name="page_link" size="30" value="<?php echo $page->page_link?>" id="page_link" />
		<script type="text/javascript">
		jQuery(function() {
			$("#title").change(function() {
				$("#page_link").val(slugify($("#title").val()));
			});
		});
		</script>
	 <div class="control-group">
	 	<label for="open" class="control-label" >Contenu </label>
	 	<div class="controls">
	   		 
			<textarea name="content" id="editor" class="textarea row-fluid"><?php echo $page->content ?></textarea>
	   	</div>
	 </div>
	 <div class="control-group">
	 	<label for="open" class="control-label" >Bref </label>
	 	<div class="controls">
	   		 <textarea id="new-metadescription" name="metadescription" class="row-fluid" ><?php echo $page->metadescription?></textarea>
	   	</div>
	 </div>
</div>



<div id="postbox-container-1" class="span4">

    <ul class="nav nav-list">
	    <li class="nav-header">Publier <b>tout de suite</b></li>
	    <li class="navbar-form">
	    	<input  class="span2" type="text" id="jj" name="jj" value="<?php echo date('d')?>" size="2" maxlength="2" autocomplete="off" />,
			<select  class="span3" id="mm" name="mm">
			<?php 
			$months=array(
					1=>'01-Jan',
					2=>'02-Feb',
					3=>'03-Mar',
					4=>'04-Apr',
					5=>'05-May',
					6=>'06-Jun',
					7=>'07-Jul',
					8=>'08-Aug',
					9=>'09-Sep',
					10=>'10-Oct',
					11=>'11-Nov',
					12=>'12-Dec');
			foreach ($months as $m=>$month){
				$s=($m==date('m'))?'selected="selected"':'';
				echo "<option value='$m' $s>$month</option>";
			}
			?>
			</select>
			 <input class="span2"  type="text" id="aa" name="aa" value="<?php echo date('Y')?>" size="4" maxlength="4" autocomplete="off" /> @ 
			 <input  class="span2" type="text" id="hh" name="hh" value="<?php echo date('H')?>" size="2" maxlength="2" autocomplete="off" /> : 
			 <input  class="span2" type="text" id="mn" name="mn" value="<?php echo date('i')?>" size="2" maxlength="2" autocomplete="off" />
		</li>
	    <li>
	    	<button type="submit" class="btn" name="publish" id="publish"  accesskey="p" >Publier</button>
		</li>
		
		 <li class="divider"></li>
		 <li class="nav-header"><b>Mots clés</b></li>
		 <li>
		 	<textarea id="new-tag-keywords" name="metakeywords"  class="row-fluid"><?php echo $page->metakeywords?></textarea><br/>
		 	<button type="button" class="btn" name="publish" onclick="autoTag('new-tag-keywords')" >Auto</button>
			<p class="howto">Séparer les mots clefs par une virgule.</p>
		 </li>
		 
		 
		 <li class="divider"></li>
		 <li class="nav-header"><b>Meta Robotss</b></li>
		 <li>
		 	<textarea id="new-tag-metarobots" name="metarobots"  class="row-fluid"><?php echo $page->metarobots?></textarea>
		 	<button type="button" class="btn" name="publish" onclick="autoTag('new-tag-metarobots')" >Auto</button>
			<p class="howto">Séparer les mots clefs par une virgule.</p>
		 </li>
    </ul>
 
    

<script type="text/javascript">
$('.textarea').wysihtml5();
function autoTag($divInput){
	var word=$('#title').val().replace(/[^a-zA-Z0-9ãàáäâẽèéëêìíïîõòóöôùúüûñç,.]+/g,' ').split(' ');
	//word=$.unique(word); 
	var uniqueArr = [];
		for (var i = word.length; i--; ) {
            var val = word[i];
            if ($.inArray(val, uniqueArr) === -1) {
                uniqueArr.unshift(val);
            }
        }
	$('#'+$divInput).val(uniqueArr.join(','));
}
</script>



</div>
	